package data
{
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.net.URLRequest;
	import flash.net.URLVariables;

	public class APIRequest extends EventDispatcher
	{
		public static const API_HEAD:String = "http://openapi.naver.com/search";
		public static const API_KEY:String = "ce4959764b16d67dbfc8ff0bedaa9802";
		
		public function APIRequest(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public static function createRequest(q:String, target:String="movieman"):URLRequest
		{
			var vars:URLVariables = new URLVariables();
			vars["key"] = API_KEY;
			vars["target"] = "image";
			vars["query"] = q//escapeMultiByte(q);
			vars["filter"] = "small";
			
			var reqObj:URLRequest = new URLRequest();
			reqObj.url = API_HEAD;
			reqObj.data = vars;
			
			return reqObj;
		}
		
	}
}